home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2.sit / Raven 1.2 / • Extras • / SGI STL / (config) / stlconf.h < prev    next >
C/C++ Source or Header  |  1997-05-28  |  11KB  |  329 lines

  1. /*
  2.  *
  3.  * Copyright (c) 1997
  4.  * Moscow Center for SPARC Technology
  5.  *
  6.  * Permission to use, copy, modify, distribute and sell this software
  7.  * and its documentation for any purpose is hereby granted without fee,
  8.  * provided that the above copyright notice appear in all copies and
  9.  * that both that copyright notice and this permission notice appear
  10.  * in supporting documentation.  Moscow Center for SPARC Technology makes no
  11.  * representations about the suitability of this software for any
  12.  * purpose.  It is provided "as is" without express or implied warranty.
  13.  *
  14.  */
  15.  
  16. #ifndef __SGI_STL_STLCONF_H
  17. # define __SGI_STL_STLCONF_H
  18.  
  19. # undef __AUTO_CONFIGURED
  20.  
  21. //==========================================================
  22. // Getting proper values of autoconf flags
  23. // if you ran 'configure', __AUTO_CONFIGURED is set to 1 and
  24. // specific compiler fetures will be used.
  25. // Otherwise, the <stlcomp.h> header will be included for per-version
  26. // features recognition.
  27. //==========================================================
  28. # if defined ( BYPASS_AUTOCONF_SETTINGS ) || ! defined (__AUTO_CONFIGURED)
  29. // per-version compiler features recognition
  30. #  include <stlcomp.h>
  31. # else
  32. // auto-configured section
  33.  
  34. // define that to disable these features
  35. # undef __STL_NO_EXCEPTIONS
  36. # undef __STL_NO_NAMESPACES
  37.  
  38. // select allocation method you like
  39. # undef __STL_USE_MALLOC
  40. # undef __STL_USE_NEWALLOC
  41.  
  42. // this one is not mandatory, just enabled
  43. # undef __STL_USE_DEFALLOC
  44.  
  45. // define NO_USING_STD if don't want using STL namespace by default
  46. // new-style-headers define that to get proper behaviour
  47. # undef  __STL_NO_USING_STD
  48.  
  49. // define __STL_USE_ABBREVS if your linker has trouble with long 
  50. // external symbols
  51. # undef __STL_USE_ABBREVS
  52.  
  53.  
  54. // unsigned 32-bit integer type
  55. #  define __STL_UINT32_T unsigned
  56. #  undef __STL_BOOL_KEYWORD
  57. #  undef __STL_RESERVED_BOOL_KEYWORD
  58. #  undef __STL_YVALS_H
  59. #  undef __STL_DEFAULT_TEMPLATE_PARAM
  60. #  undef __STL_DEFAULT_TYPE_PARAM
  61. #  undef __STL_STATIC_TEMPLATE_DATA
  62. #  undef __STL_RAND48
  63. #  undef __STL_LOOP_INLINE_PROBLEMS
  64. #  undef __STL_NAMESPACES
  65. #  undef __STL_TYPENAME
  66. #  undef __STL_EXPLICIT
  67. #  undef __STL_USE_EXCEPTIONS
  68. #  undef __STL_EXCEPTION_SPEC
  69. #  undef __STL_WEAK_ATTRIBUTE
  70. #  undef __STL_BASE_MATCH_BUG
  71. #  undef __STL_NESTED_TYPE_PARAM_BUG
  72. #  undef __STL_UNUSED_REQUIRED_BUG
  73. #  undef __STL_UNINITIALIZABLE_PRIVATE
  74. #  undef __STL_BASE_TYPEDEF_BUG
  75. #  undef __STL_BASE_TYPEDEF_OUTSIDE_BUG
  76. #  undef __STL_CONST_CONSTRUCTOR_BUG
  77.  
  78. #  undef __STL_NEW_HEADER_NAMES
  79. #  undef __STL_NEW_STYLE_CASTS
  80. #  undef __STL_WCHAR_T
  81. #  undef __STL_LONG_LONG
  82. #  undef __STL_LONG_DOUBLE
  83. #  undef __STL_MUTABLE
  84. #  undef __STL_FULL_SPEC_SYNTAX
  85. #  undef __STL_BAD_ALLOC_DEFINED
  86. #  undef __STL_DEBUG_ALLOC
  87. #  undef __STL_MEMBER_TEMPLATES
  88. #  undef __STL_FRIEND_TEMPLATES
  89. #  undef __STL_CLASS_PARTIAL_SPECIALIZATION
  90. #  undef __STL_FUNC_PARTIAL_ORDERING
  91. #  undef __STL_AUTOMATIC_TYPE_TRAITS
  92. #  undef __STL_MEMBER_POINTER_PARAM_BUG
  93. # endif /* AUTO_CONFIGURED */
  94.  
  95. //==========================================================
  96.  
  97. //==========================================================
  98. // final workaround tuning based on given flags
  99. //==========================================================
  100.  
  101. // some justification
  102.  
  103. # if !defined ( __STL_STATIC_TEMPLATE_DATA )
  104. #   define __STL_STATIC_TEMPLATE_DATA 0
  105. #  if !defined ( __STL_WEAK_ATTRIBUTE )
  106. #   define __STL_WEAK_ATTRIBUTE 0
  107. #  endif
  108. # endif
  109.  
  110. # if defined (__STL_BASE_TYPEDEF_BUG)
  111. #  undef  __STL_BASE_TYPEDEF_OUTSIDE_BUG
  112. #  define __STL_BASE_TYPEDEF_OUTSIDE_BUG 1
  113. # endif
  114.  
  115. // features tuning 
  116. # ifdef __STL_DEBUG
  117. #  define __STL_ASSERTIONS 1
  118. # endif
  119.  
  120. # ifdef __STL_ASSERTIONS
  121. #  define __stl_assert(expr) ¥
  122.     if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s¥n", ¥
  123.               __FILE__, __LINE__, # expr); abort(); }
  124. # else
  125. #  define __stl_assert(expr)
  126. # endif
  127.  
  128. # ifdef __STL_DEBUG
  129. #  define __stl_verbose_assert(expr,diagnostic) ¥
  130.     if (!(expr)) { fprintf(stderr, "%s:%d STL error : %s¥n%s:%d STL assertion failure: %s¥n",¥
  131.               __FILE__, __LINE__ , diagnostic, __FILE__, __LINE__ , # expr ); abort(); }
  132.  
  133. #  define __stl_debug_check(expr) __stl_assert(expr)
  134. #  define __stl_debug_do(expr) expr
  135. # else
  136. #  define __stl_verbose_assert(expr,diagnostic) __stl_assert(expr)
  137. #  define __stl_debug_check(expr)
  138. #  define __stl_debug_do(expr)
  139. # endif
  140.  
  141. # ifdef __STL_RAND48
  142. #  define __rand lrand48
  143. # else
  144. #  define __rand rand
  145. # endif
  146.  
  147. // tuning of static template data members workaround
  148. # if ( __STL_STATIC_TEMPLATE_DATA < 1 )
  149. // ignore __PUT directive in this case
  150. #  if ( __STL_WEAK_ATTRIBUTE > 0 )
  151. #   define __DECLARE_INSTANCE(type,item,init) type item __attribute__ (( weak )) = init
  152. #  else
  153. #   ifdef __PUT_STATIC_DATA_MEMBERS_HERE
  154. #    define __DECLARE_INSTANCE(type,item,init) type item = init
  155. #   else
  156. #    define __DECLARE_INSTANCE(type,item,init)
  157. #   endif /* __PUT_STATIC_DATA_MEMBERS_HERE */
  158. #  endif /* __STL_WEAK_ATTRIBUTE */
  159. # endif /* __STL_STATIC_TEMPLATE_DATA */
  160.  
  161. // default parameters as template types derived from arguments ( not always supported )
  162. #  if ! defined (__STL_DEFAULT_TEMPLATE_PARAM)
  163. #   define __DFL_TMPL_PARAM( classname, defval ) class classname
  164. #   define __DFL_TMPL_ARG(classname) , classname
  165. #  else
  166. #   define __STL_DEFAULT_TYPE_PARAM 1
  167. #   define __DFL_TMPL_PARAM( classname, defval ) class classname = defval
  168. #   define __DFL_TMPL_ARG(classname)  
  169. #  endif
  170.  
  171. // default parameters as complete types
  172. # if defined ( __STL_DEFAULT_TYPE_PARAM )
  173. #   define __DFL_TYPE_PARAM( classname, defval ) class classname = defval
  174. #   define __DFL_TYPE_ARG(classname)
  175. # else
  176. #  define __DFL_TYPE_PARAM( classname, defval ) class classname
  177. #  define __DFL_TYPE_ARG(classname) , classname
  178. # endif
  179.  
  180. // default parameters workaround tuning
  181. #  if defined  ( __STL_DEFAULT_TYPE_PARAM ) || ( defined ( __STL_NAMESPACES )&&! defined (__STL_NO_NAMESPACES))
  182. #    define __WORKAROUND_RENAME(X) X
  183. #  else
  184. #    define __WORKAROUND_RENAME(X) __##X
  185. #  endif
  186.  
  187. // namespace selection
  188. # if defined (__STL_NAMESPACES) && ! defined (__STL_NO_NAMESPACES)
  189.  
  190. // change this if don't think that is standard enough ;)
  191. #  define __STL_NAMESPACE std
  192. #  define __BEGIN_STL_NAMESPACE namespace __STL_NAMESPACE {
  193. #  define __STL_USING_NAMESPACE  using namespace __STL_NAMESPACE ;
  194.  
  195. #  ifdef __STL_NO_USING_STD
  196. #   define __USING_NAMESPACE
  197. #  else
  198. #   define __USING_NAMESPACE using namespace __STL_NAMESPACE ;
  199. #  endif
  200. #  ifdef __STL_DEFAULT_TYPE_PARAM
  201. #    define __STL_FULL_NAMESPACE __STL_NAMESPACE
  202. #    define __BEGIN_STL_FULL_NAMESPACE
  203. #    define __END_STL_FULL_NAMESPACE
  204. #  else
  205. #    define __STL_FULL_NAMESPACE sgi_full
  206. #    define __BEGIN_STL_FULL_NAMESPACE namespace __STL_FULL_NAMESPACE {
  207. #    define __END_STL_FULL_NAMESPACE } ;
  208. #  endif
  209. #  define __END_STL_NAMESPACE }; __USING_NAMESPACE
  210.     // workaround tuning
  211. #  define __FULL_NAME(X) __STL_FULL_NAMESPACE::__WORKAROUND_RENAME(X)
  212. # else /* __STL_NAMESPACES */
  213. #  define __STL_NAMESPACE
  214. #  define __STL_FULL_NAMESPACE
  215. #  define __BEGIN_STL_NAMESPACE
  216. #  define __END_STL_NAMESPACE
  217. #  define __BEGIN_STL_FULL_NAMESPACE
  218. #  define __END_STL_FULL_NAMESPACE
  219. #  define __STL_USING_NAMESPACE
  220.     // workaround tuning
  221. #  define __FULL_NAME(X) __WORKAROUND_RENAME(X)
  222. # endif  /* __STL_NAMESPACES */
  223.  
  224. #  define __STL_NAME(name) __STL_NAMESPACE::name  // Lo Russo Graziano <Graziano.LoRusso@CSELT.IT>
  225.  
  226.  
  227. // advanced keywords usage
  228. #  ifdef  __STL_NEW_STYLE_CASTS
  229. #   define __CONST_CAST(x,y) const_cast<x>(y)
  230. #  else
  231. #   define __CONST_CAST(x,y) ((x)y)
  232. #  endif
  233.  
  234. #  ifndef __STL_TYPENAME
  235. #   define typename
  236. #  endif
  237.  
  238. #  ifndef __STL_EXPLICIT
  239. #   define explicit
  240. #  endif
  241.  
  242. #  ifdef __STL_MUTABLE
  243. #   define __ASSIGN_MUTABLE(type,x,y) x=y
  244. #  else
  245. #   define __ASSIGN_MUTABLE(type,x,y) __CONST_CAST(type,x)=y
  246. #   define mutable
  247. #  endif
  248.  
  249. // exception-specific macros.
  250. // most of them require double parens : (())
  251. #  if defined ( __STL_NO_EXCEPTIONS) || ! defined (__STL_USE_EXCEPTIONS)
  252. #  define __TRY    
  253. #  define __CATCH(x)      if (false)   
  254. #  define __THROW(arg)    
  255. #  define __RETHROW
  256. #  else
  257. #  define __CATCH(x)      catch x
  258. #  define __TRY           try
  259. #  define __THROW(arg)    throw arg
  260. #  define __RETHROW       throw
  261. #  endif
  262.  
  263. // throw specification ( used in inline constructors 
  264. // to improve efficiency some compilers )
  265. // param count is variable, parens used.
  266. #  if defined ( __STL_NO_EXCEPTIONS ) || ! defined ( __STL_EXCEPTION_SPEC )  
  267. #   define __THROWS(x)
  268. #  else
  269. #   define __THROWS(x) throw x
  270. #  endif
  271.  
  272. #  if defined (__STL_LOOP_INLINE_PROBLEMS)
  273. #   define INLINE_LOOP
  274. #  else
  275. #   define INLINE_LOOP inline 
  276. #  endif
  277.  
  278. #if defined ( __STL_UNINITIALIZABLE_PRIVATE )
  279. #  define __PRIVATE public
  280.    // Extra access restrictions prevent us from really making some things
  281.    // private.
  282. #else
  283. #  define __PRIVATE private
  284. #endif
  285.  
  286. #  ifdef __STL_FULL_SPEC_SYNTAX
  287. #   define __STL_FULL_SPECIALIZATION template<>
  288. #  else
  289. #   define __STL_FULL_SPECIALIZATION
  290. #  endif
  291.  
  292. #  define __IMPORT_CONTAINER_TYPEDEFS(super)                            ¥
  293.     typedef typename super::value_type value_type;                               ¥
  294.     typedef typename super::reference reference;                                 ¥
  295.     typedef typename super::size_type size_type;                                 ¥
  296.     typedef typename super::const_reference const_reference;                     ¥
  297.     typedef typename super::difference_type difference_type;
  298.  
  299. #  define __IMPORT_ITERATORS(super)                                              ¥
  300.     typedef typename super::iterator iterator;                                   ¥
  301.     typedef typename super::const_iterator const_iterator; 
  302.  
  303. #  define __IMPORT_REVERSE_ITERATORS(super)                                      ¥
  304.     typedef typename super::const_reverse_iterator  const_reverse_iterator;      ¥
  305.     typedef typename super::reverse_iterator reverse_iterator;
  306.  
  307. #define  __IMPORT_SUPER_COPY_ASSIGNMENT(__derived_name)         ¥
  308.     __derived_name(const self& x) : super(x) {}                 ¥
  309.     __derived_name(const super& x) : super(x) {}                ¥
  310.     self& operator=(const self& x) {                            ¥
  311.         super::operator=(x);                                    ¥
  312.         return *this;                                           ¥
  313.     }                                                           ¥
  314.     self& operator=(const super& x) {                           ¥
  315.         super::operator=(x);                                    ¥
  316.         return *this;                                           ¥
  317.     }
  318.  
  319. # if defined (__STL_BASE_TYPEDEF_OUTSIDE_BUG) || defined (__STL_NESTED_TYPE_PARAM_BUG)
  320. #   define __CONTAINER_SUPER_TYPEDEFS ¥
  321.  __IMPORT_CONTAINER_TYPEDEFS(super) __IMPORT_ITERATORS(super) __IMPORT_REVERSE_ITERATORS(super)
  322. # else
  323. #   define __CONTAINER_SUPER_TYPEDEFS
  324. # endif
  325.  
  326. //==========================================================
  327.  
  328. #endif /* __STLCONF_H */
  329.